home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 4
/
Precision Software Applications Silver Collection Volume 4 (1993).iso
/
stats
/
chadyn.exe
/
YHENON.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-11-28
|
1KB
|
62 lines
/******************************* YHENON.C ************************************/
/********************* (C) 1986,7,8 by JAMES A. YORKE ************************/
#include "yinclud.h"
Henon() {
int i;
int base;
double y_temp[6],
temp;
if(num_lyap == 0) {
temp = rho - (*y) * (*y) + C1 * y[1];
y[1] = *y;
y[0] = temp;
/* temp = rho -y[0]*y[0] + C1*y[1];
y[1] = y[0];
y[0] = temp;
*/
}
else {
y_temp[0] = rho - y[0] * y[0] + C1 * y[1];
y_temp[1] = y[0];
for(i = 0; i < num_lyap; i++) {
base = lyapzero + vec_dim * i;
y_temp[base]
= -2 * y[0] * y[base]
+ C1 * y[base + 1];
y_temp[base + 1]
= y[base];
}
for(i = 0; i < lyapzero + vec_dim * num_lyap; i++)
y[i] = y_temp[i];
}
}
initHenon() {
/* Henon */
vec_dim = 2; /* the dimension of the Lyapunov vectors =
phase space dim */
num_lyap = 0; /* the number of Lyapunov numbers to be
computed <=vec_dim */
lyapzero = 2; /* y[lyapzero] is the zeroth coord of the
zeroth lyapunov vector */
dim = lyapzero + num_lyap * vec_dim;
/* needed for rungekutta */
X_upper = 2.0; /* x scale */
X_lower = -2.0;
Y_upper = 2.0; /* y scale */
Y_lower = -2.0;
C1 =.3;
rho = 1.4;
map = Henon;
}